home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 2 / Atari Mega Archive CD - Volume 2.iso / 8bit / cislib_a / first.bin < prev    next >
Text File  |  1995-04-22  |  1KB  |  1 lines

  1. ; FIRST.ACT  --  a few odd PROCs/FUNCs¢¢;   LegalDrive - allows determining if¢       the specified drive number is¢       recognized by DOS¢¢;   MaskInput - uses underlines as input¢       masking for user responses¢¢;   UnMask - cleans off excess masking¢       that the editor picks up¢¢;   Find - returns the position in a¢       CHAR ARRAY (string) where the¢       sub-string was found, returns¢       0 if not found - search begins¢       at the position specified by¢       start¢ ¢; ------------------------------------¢       ¢BYTE FUNC LegalDrive(BYTE drive_num)¢BYTE drvbyt=$070A, bit, i¢BYTE ARRAY mask=[1 2 4 8 16 32 64 128], drive(8)¢  FOR bit=0 TO 7¢  DO¢    drive(bit)=(drvbyt&mask(bit)) RSH bit¢  OD¢RETURN(drive(drive_num-1))¢¢PROC MaskInput(BYTE width)¢BYTE i¢  FOR i=1 TO width¢  DO¢    Put('_)¢  OD¢  FOR i=1 TO width¢  DO¢    Put(')¢  OD¢RETURN¢¢PROC UnMask(CHAR ARRAY source,destination)¢BYTE i¢  FOR i=1 TO source(0)¢  DO¢    IF source(i)<>'_ THEN¢      destination(i)=source(i)¢    ELSE¢      EXIT¢    FI¢  OD¢  destination(0)=i-1¢RETURN¢¢BYTE FUNC Find(CHAR ARRAY str,sub BYTE start)¢BYTE i, j¢CHAR ARRAY tmp¢  FOR i=start TO str(0)¢  DO¢    IF sub(1)=str(i) THEN¢      tmp(0)=sub(0)¢      FOR j=1 TO sub(0)¢      DO¢        tmp(j)=str(j+i-1)¢      OD¢      IF SCompare(tmp,sub)=0 THEN¢        RETURN(i)¢      FI¢    FI¢  OD¢RETURN(0)¢¢